package widget;

import javax.swing.*;
import java.util.HashMap;

/**
 * Created by LLAP on 2017/12/13.
 * Copyright (c) 2017 LLAP. All rights reserved.
 */
public abstract class TComponent {
    protected JComponent field;
    protected String name;

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    protected String comment = "";
    protected boolean required;
    public TComponent(String name, JComponent field, String comment, boolean required) {
        this.field = field;
        this.name = name;
        this.comment = comment;
        this.required = required;
    }
    public TComponent(String name, JComponent field, boolean required) {
        this(name, field, "", required);
    }
    public TComponent(String name, JComponent field, String comment) {
        this(name, field, comment, false);
    }
    public TComponent(String name, JComponent field) {
        this(name, field, "");
    }
    public TComponent(String name, boolean required) {
        this(name, null, required);
    }
    public TComponent(String name, String comment) {
        this(name, null, comment);
    }
    public TComponent(boolean required) {
        this(null, required);
    }
    public TComponent() {
        this(false);
    }
    public void setName(String name) {
        this.name = name;
    }
    public abstract HashMap<String, Object> getData() throws IllegalArgumentException;
    public abstract void clear();
}
